# Use "in" keyword
items := {
    {"id": "a-phone", "color": "red", "type": "phone"},
    {"id": "b-phone", "color": "red", "type": "phone"},
    {"id": "a-pad", "color": "red", "type": "tablet"},
    {"id": "b-pad", "color": "blue", "type": "tablet"}
}
every_item_is_red_or_blue if {
    every item in items {
        item.color in {"red", "blue"}
    }
}

# Use customized functions
is_not_red_or_is_phone(item) if not item.color == "red"
is_not_red_or_is_phone(item) if item.type == "phone"
every_phone_is_red if {
    every item in items {
        is_not_phone_or_is_red(item)
    }
}

# Use local scope
items := {
    {"id": "a-phone", "color": "red", "type": "phone"},
    {"id": "b-phone", "color": "red", "type": "phone"},
    {"id": "a-pad", "color": "red", "type": "tablet"},
    {"id": "b-pad", "color": "blue", "type": "tablet"}
}
every_phone_is_red_2 if {
    phones := {
        item |
            some item in items
            item.type == "phone"
        }
    every item in phones {
        item.color == "red"
    }
}
every_red_item_is_phone if {
    red_items := {
        item |
            some item in items
            item.color == "red"
        }
    every item in red_items {
        item.type == "phone"
    }
}
